#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include "elapsed.cpp"
using namespace std;

int main(int argc, char **argv)
{
<<<<<<< local
   int N;
   int P;
   int c;
   
	while ((c = getopt(argc, argv, "n:p:")) != -1) {
		switch(c) {
			case 'n':
				N = atoi(optarg);
				break;
			case 'p':
			    P = atoi(optarg);
				break;
			case '?':
				cerr << "Please enter a number:" << endl;
				return 1;
			default:
				abort();
			}
    }

=======
    int N = 1e5;
    //int pos = 5e6;
>>>>>>> other
    struct timespec start, end, res;

    vector<int> myvector;
    vector<int>::iterator itVec;

    list<int> mylist;
<<<<<<< local
    list<int>::iterator itList;
	
	map<int, int> mymap;
=======
    //list<int>::iterator itList;
>>>>>>> other

    gettime(start);
<<<<<<< local
	for (int i = 0; i < N; i++) {
		myvector.push_back(i);
		}
=======
    for (int i = 0; i < N; i++) {
        myvector.push_back(i);
    }
>>>>>>> other
    gettime(end);
    res =  diff(start, end);
    cout << "vector inserting costs " << res.tv_sec + res.tv_nsec / 10.0e9 
        << " seconds." << endl;

    gettime(start);
<<<<<<< local
	for (int i = 0; i <= N; i++) {
	    mylist.push_back(i);}
=======
    for (itVec = myvector.begin(); itVec != myvector.end(); itVec++) {
        myvector.erase(itVec);
    }
    gettime(end);
    res =  diff(start, end);
    cout << "vector removing costs " << res.tv_sec + res.tv_nsec / 10.0e9 
        << " seconds." << endl;

    //itList = mylist.begin();
    //for (int i = 0; i <= pos; i++)
    //   itList++;
    gettime(start);
    for (int i = 0; i < N; i++) {
        mylist.push_back(i);
    }
>>>>>>> other
    gettime(end);
    res = diff(start, end);
    cout << "list inserting costs " << res.tv_sec + res.tv_nsec / 10.0e9 
        << " seconds." << endl;

<<<<<<< local
	gettime(start);
	for (int i = 0; i <= N; i ++) {
	    mymap[i] = i;
	}
	gettime(end);
	res = diff(start, end);
    cout << "map inserting costs " << res.tv_sec + res.tv_nsec / 10.0e9 
        << " seconds." << endl;
		
	gettime(start);
	mymap.find(P);
	res = diff(start, end);
    cout << "map finding costs " << res.tv_sec + res.tv_nsec / 10.0e9 
        << " seconds." << endl;
		
	gettime(start);
	myvector.clear();
	gettime(end);
	res = diff(start, end);
    cout << "vector removing costs " << res.tv_sec + res.tv_nsec / 10.0e9 
        << " seconds." << endl;
		
=======
    map<int, int> mymap;
    //mymap.insert (pair<char, int>('a', 100)); 
    //mymap.insert (pair<char, int>('z', 200)); 
    //map<char, int>::iterator itMap; 
    //itMap = mymap.begin();
>>>>>>> other
    gettime(start);
<<<<<<< local
	mylist.clear();
	gettime(end);
	res = diff(start, end);
    cout << "list removing costs " << res.tv_sec + res.tv_nsec / 10.0e9 
        << " seconds." << endl;
	
	gettime(start);
	mymap.clear();
	gettime(end);
	res = diff(start, end);
    cout << "map removing costs " << res.tv_sec + res.tv_nsec / 10.0e9 
        << " seconds." << endl;
	
   
    //gettime(start);
    //mymap.insert(itMap, pair<char, int>('b',300));
    //gettime(end);
    //res = diff(start, end);
    //cout << "map inserting costs" << res.tv_sec + res.tv_nsec / 10.0e9
	  //   << "seconds." << endl;
=======
    for (int i = 0; i < N; i++) {
        mymap[i] = i;
    }
    gettime(end);
    res = diff(start, end);
    cout << "map inserting costs" << res.tv_sec + res.tv_nsec / 10.0e9
	     << "seconds." << endl;
>>>>>>> other



//set<int> myset;
//gettime(start);	
//myset.erase (itSet);
//gettime(end);
//res = diff(start, end);
//cout << "set erasing costs " << res.tv_sec + res.tv_nsec / 10.0e9
  //  << " seconds." << endl;

/*
    for (it = myvector.begin(); it < myvector.end(); it++)
        cout << ' ' << *it;
    cout << '\n';
    */
}
